package nige.mesure.fenetre;

import javax.swing.JFrame;

import nige.mesure.ecran.Connexion;
import nige.mesure.ecran.LogPrincipale;
import nige.mesure.mail.SendMail;

/**
 * ------------------------------------------
 * -            -                           -
 * -  Screen11  -          Screen12         -
 * -            -                           -
 * ------------------------------------------
 * -            -             -             -
 * -            -             -             -
 * -            -             -             -
 * -            -             -             -
 * -            -             -             -
 * -  Screen21  -  Screen22   -   Screen23  -
 * -            -             -             -
 * -            -             -             -
 * -            -             -             -
 * -            -             -             -
 * -            -             -             -
 * ------------------------------------------
 * -                                        -
 * -                Screen3                 -
 * -                                        -
 * ------------------------------------------
 * 
 * @author Nicolas Genevaux
 *
 */
@SuppressWarnings("serial")
public class FenetrePrincipale extends JFrame {
	/**
	 * Version de l'application
	 */
	public static String VERSION = "v.0.1";
	/**
	 * Version de la base correspondante
	 */
	public static String VERSIONDATABASE = "v.0.1";
	/**
	 * Fichier temporaire
	 */
	public static String FICHIERTMP = "mesures.tmp";
	/**
	 * Fenetre principal pour l'acces a partir des autres classes
	 */
	public static FenetrePrincipale FEN = null;
	/**
	 * Ecran 11
	 */
	public Screen screen11 = null;
	/**
	 * Ecran 12
	 */
	public Screen screen12 = null;
	/**
	 * Ecran 21
	 */
	public Screen screen21 = null;
	/**
	 * Ecran 22
	 */
	public Screen screen22 = null;
	/**
	 * Ecran 3
	 */
	public Screen screen3 = null;
	/**
	 * Entree principale du programme
	 * @param args Argument passe en parametre
	 */
	public static void main(String[] args) {
		FEN = new FenetrePrincipale();
		FEN.initFenetre();
		FEN.setVisible(true);
		SendMail.send();
	}
	/**
	 * Constructeur de la classe
	 */
	public FenetrePrincipale() {
		super("Mesures "+VERSION);
	}
	/**
	 * Initialisation de la fenetre
	 */
	public void initFenetre() {
		setJMenuBar(new MenuPrincipale());
		this.setSize(500,500);
		this.setExtendedState(this.getExtendedState()|MAXIMIZED_BOTH);
		this.setLayout(null);
		setDefaultCloseOperation(EXIT_ON_CLOSE);
		screen11 = new Screen(0,0,1,2);
		this.add(screen11);
		(new Connexion(screen11)).dessine();
		screen12 = new Screen(1,0,2,2);
		this.add(screen12);
		screen21 = new Screen(0,2,1,4);
		this.add(screen21);
		screen22 = new Screen(1,2,2,4);
		this.add(screen22);
		screen3 = new Screen(0,6,3,1);
		this.add(screen3);
		(new LogPrincipale(screen3)).dessine();
	}
	
}
